﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BusLib
{
    public partial class Event
    {
        static public Event Get(string EventType, Bus bus, System.DateTime time, Route route)
        {
            BusLibDataContext db = BusLibDataContext.db;
            if (db.Events.Any(e => (e.EventType == EventType) && (e.Bus == bus) && (e.Time == time) && (e.Route == route)))
            {
                return db.Events.Single(e => (e.EventType == EventType) && (e.Bus == bus) && (e.Time == time) && (e.Route == route));
            }
            else
            {
                return null;
            }
        }
    }

}
